 <?php
  require_once('includes/general.php');
  if(!tep_db_checkDb()) die('ko ket noi dc csdl');
//$find=$_GET["searching"];
 
 //This is only displayed if they have submitted the form 
 if ($searching =="yes") 
 { 
 echo "<h2>Results</h2><p>"; 
 
 //If they did not enter a search term we give them an error 
 if ($find == "") 
 { 
 echo "<p>You forgot to enter a search term"; 
 exit; 
 } 
 
 // Otherwise we connect to our Database 
 /**
 * $query="select * from tbl_san_pham where ten_san_pham like \"%$trimmed%\" order by ten_san_pham";
 */
 
 // We preform a bit of filtering 
 $find = strtoupper($find); 
 $find = strip_tags($find); 
 $find = trim ($find); 
 
 //Now we search for our search term, in the field the user specified 
 $data = tep_db_query("SELECT * FROM tbl_san_pham WHERE ten_san_pham LIKE'%$find%'"); 
 
 //And we display the results 
 while($result = tep_db_fetch_array( $data )) 
 { 
 echo $result['ten_san_pham']; 
 echo " "; 
 echo $result['mo_ta_san_pham']; 
 echo "<br>"; 
 echo $result['hinh_anh']; 
 echo "<br>"; 
 echo "<br>"; 
 } 
 
 //This counts the number or results - and if there wasn't any it gives them a little message explaining that 

 
 //And we remind them what they searched for 
 echo "<b>Searched For:</b> " .$find; 
 } 
 ?> 
 
 